def test_extract(self): attr = Attribute(name='test') assert attr.extract(value='some value') == 'some value' assert attr.extract(value=1) == '1' attr = Attribute(name='test', attr_type=int) assert attr.extract(value=1) == 1 attr = Attribute(name='test', is_datetime=True) dt = datetime(2000, 12, 12, tzinfo=UTC) assert attr.extract(value=dt) == 976579200.0 attr = Attribute(name='test', is_uuid=True) uid = uuid.uuid4() assert attr.extract(value=uid) == uid.hex
class UserGITLABEvent(Event): event_type = USER_GITLAB actor_id = 'id' attributes = ( Attribute('id'), )
class UserRegisteredEvent(Event): event_type = USER_REGISTERED actor_id = 'id' attributes = ( Attribute('id'), )
class JobDeletedEvent(Event): event_type = JOB_DELETED attributes = (Attribute('id'), )
class ExperimentGroupNewStatusEvent(Event): event_type = EXPERIMENT_GROUP_NEW_STATUS attributes = ( Attribute('id'), Attribute('project.id'), Attribute('project.user.id'), Attribute('user.id'), Attribute('updated_at', is_datetime=True), Attribute('concurrency', is_required=False), Attribute('search_algorithm', is_required=False), Attribute('has_early_stopping', attr_type=bool, is_required=False), Attribute('has_description', attr_type=bool), Attribute('last_status'), Attribute('previous_status', is_required=False), )
class UserDeletedEvent(Event): event_type = USER_DELETED actor_id = 'actor_id' attributes = (Attribute('id'), Attribute('actor_id'))
class NotebookCleanedTriggeredEvent(Event): event_type = NOTEBOOK_CLEANED_TRIGGERED attributes = (Attribute('id'), )
class UserDeletedEvent(Event): event_type = USER_DELETED actor = True attributes = ( Attribute('id'), )
class ExperimentNewMetricEvent(Event): event_type = EXPERIMENT_NEW_METRIC attributes = (Attribute('id'), Attribute('project.id'), Attribute('experiment_group.id', is_required=False))
class ExperimentDeletedEvent(Event): event_type = EXPERIMENT_DELETED attributes = (Attribute('id'), )
class DummyEvent2(Event): event_type = 'dummy.event' actor = True actor_id = 'some_actor_id' actor_name = 'some_actor_name' attributes = (Attribute('attr1'), )
class DummyEvent1(Event): event_type = 'dummy.event' actor = True attributes = (Attribute('attr1'), )
class BuildJobDeletedEvent(Event): event_type = BUILD_JOB_DELETED attributes = (Attribute('id'), )
class ExperimentGroupViewedEvent(Event): event_type = EXPERIMENT_GROUP_VIEWED actor_id = 'actor_id' attributes = ( Attribute('id'), Attribute('project.id'), Attribute('project.user.id'), Attribute('user.id'), Attribute('actor_id'), Attribute('updated_at', is_datetime=True), Attribute('concurrency', is_required=False), Attribute('search_algorithm', is_required=False), Attribute('has_early_stopping', attr_type=bool, is_required=False), Attribute('has_description', attr_type=bool), Attribute('last_status'), )
class ExperimentJobNewStatusEvent(Event): event_type = EXPERIMENT_JOB_NEW_STATUS attributes = ( Attribute('id'), )
class UserActivatedEvent(Event): event_type = USER_ACTIVATED actor = True attributes = ( Attribute('id'), )
class ExperimentCleanedTriggeredEvent(Event): event_type = EXPERIMENT_CLEANED_TRIGGERED attributes = (Attribute('id'), )
class NotebookDeletedEvent(Event): event_type = NOTEBOOK_DELETED attributes = (Attribute('id'), )
class ExperimentCreatedEvent(Event): event_type = EXPERIMENT_CREATED actor = True actor_id = 'user.id' actor_name = 'user.username' attributes = ( Attribute('id'), Attribute('project.id'), Attribute('project.user.id'), Attribute('experiment_group.id', is_required=False), Attribute('experiment_group.user.id', is_required=False), Attribute('created_at', is_datetime=True), Attribute('has_description', attr_type=bool), Attribute('is_resume', attr_type=bool), Attribute('is_restart', attr_type=bool), Attribute('is_copy', attr_type=bool), Attribute('is_clone', attr_type=bool), Attribute('is_independent', attr_type=bool), Attribute('has_specification', attr_type=bool), Attribute('framework', attr_type=bool, is_required=False), )
class UserActivatedEvent(Event): event_type = USER_ACTIVATED actor_id = 'actor_id' attributes = (Attribute('id'), Attribute('actor_id'))
class ProjectSetPublicEvent(Event): event_type = PROJECT_SET_PUBLIC attributes = ( Attribute('id'), Attribute('user.id'), )
class DummyEvent(Event): event_type = 'dummy.event' actor_id = 'actor_id' attributes = (Attribute('attr1'), )
class ProjectSetPrivateEvent(Event): event_type = PROJECT_SET_PRIVATE attributes = ( Attribute('id'), Attribute('user.id'), )
class ExperimentGroupStoppedTriggeredEvent(Event): event_type = EXPERIMENT_GROUP_STOPPED_TRIGGERED actor = True attributes = ( Attribute('id'), Attribute('project.id'), Attribute('project.user.id'), Attribute('user.id'), Attribute('updated_at', is_datetime=True), Attribute('concurrency', is_required=False), Attribute('search_algorithm', is_required=False), Attribute('has_early_stopping', attr_type=bool, is_required=False), Attribute('has_description', attr_type=bool), Attribute('last_status'), Attribute('pending', attr_type=bool, is_required=False), )
class ProjectDeletedEvent(Event): event_type = PROJECT_DELETED attributes = ( Attribute('id'), Attribute('is_public', attr_type=bool), )
class JobCleanedTriggeredEvent(Event): event_type = JOB_CLEANED_TRIGGERED attributes = (Attribute('id'), )
class TensorboardCleanedTriggeredEvent(Event): event_type = TENSORBOARD_CLEANED_TRIGGERED attributes = (Attribute('id'), )
class UserUpdatedEvent(Event): event_type = USER_UPDATED actor_id = 'id' attributes = ( Attribute('id'), )
def test_name_should_not_be_instance(self): with self.assertRaises(AssertionError): Attribute(name='instance')
class UserBITBUCKETEvent(Event): event_type = USER_BITBUCKET actor_id = 'id' attributes = ( Attribute('id'), )